package java115.Thread;
//继承 Thread, 重写 run
public class Demo1 {
    private static class MyThread extends Thread {
        @Override
        public void run() {
            for (int i = 0; i < 5; i++) {
                System.out.println("执行MyThread线程");
                try{
                    //让线程休眠一段时间
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }
    }
    public static void main(String[] args) {
        MyThread t1 = new MyThread();
        t1.start(); //启动线程
    }
}
